From 266fd25757e698ce00e061f5e23a2f5fc9edafc8 Mon Sep 17 00:00:00 2001 From: "sos22@donkeykong.cl.cam.ac.uk" Date: Fri, 6 Aug 2004 09:51:21 +0000 Subject: [PATCH] bitkeeper revision 1.1108.1.44 (411354999nduqdyeTZj322J-xHX8zw) Add support for detaching and resuming. It isn't obvious that these are useful things to do in what is nominally a post-mortem debugger, but do it anyway. --- xen/arch/x86/xdb.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/xen/arch/x86/xdb.c b/xen/arch/x86/xdb.c index 1b5bd0feb0..b7bf77057a 100644 --- a/xen/arch/x86/xdb.c +++ b/xen/arch/x86/xdb.c @@ -14,6 +14,7 @@ struct xendbg_context { int serhnd; u8 reply_csum; + int currently_attached:1; }; static void @@ -250,9 +251,20 @@ process_command(char *received_packet, struct pt_regs *regs, break; case 'D': resume = 1; + ctx->currently_attached = 0; retry = xendbg_send_reply("", ctx); break; case 'c': /* Resume at current address */ + ctx->currently_attached = 1; + resume = 1; + retry = 0; + break; + case 'Z': /* We need to claim to support these or gdb + won't let you continue the process. */ + case 'z': + retry = xendbg_send_reply("OK", ctx); + break; + case 's': /* Single step */ case '?': retry = xendbg_send_reply("S01", ctx); @@ -306,6 +318,13 @@ __trap_to_xendbg(struct pt_regs *regs) interrupts while we're here. */ local_irq_save(flags); + /* If gdb is already attached, tell it we've stopped again. */ + if (xdb_ctx.currently_attached) { + do { + r = xendbg_send_reply("S01", &xdb_ctx); + } while (r != 0); + } + while (resume == 0) { r = receive_command(recv_buf, &xdb_ctx); if (r < 0) { -- 2.30.2